<!DOCTYPE html>
<html lang="utf-8">
<head>
    <meta charset="UTF-8">
    <#include "/comm/module-index.ftl"/>
</head>
<body>
<div class="layui-div-body">
    <div class="layui-fluid  layui-div-table">
        <div>
            <form class="layui-form searchForm" autocomplete="off" id="searchForm" lay-filter="searchForm"
                  autocomplete="off">
                <div class="layui-inline layui-show-xs-block">
                    <input type="text" name="keyword" placeholder="关键字" autocomplete="off"
                           class="layui-input">
                </div>
                <div class="layui-inline layui-show-xs-block">
                    <button class="layui-btn  layui-btn-sm" lay-submit="" lay-filter="table-search"><i
                                class="layui-icon"></i>查询
                    </button>
                    <button class="layui-btn  layui-btn-sm layui-btn-primary" type="reset" id="btn-search-reset"><i
                                class="layui-icon"></i>重置
                    </button>

                </div>
            </form>
            <div class="common-btn-block">
                <button class="layui-btn layui-btn-sm" lay-on="add"><i
                            class="layui-icon  layui-icon-add-1"></i> 添加
                </button>
            </div>
        </div>
        <#-- table-->
        <div class="layui-table-body" style="flex: 1" id="layui-table-bar">
            <table class="layui-hide" lay-filter="layui-table-main" id="layui-table-main"></table>
        </div>
    </div>
</div>
<script type="text/html" id="myOperateBtn">
    {{#  if(d._status >-2){ }}
    <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="reset"><i class="layui-icon layui-icon-password"></i>密码重置</a>
    {{#  } }}
</script>
<script type="text/javascript">
    layui.use(['index'], function () {
        let tableBase = layui.index;
        tableBase.render({
            cols: [{type: 'space', hide: true, field: "_id"},
                {type: 'numbers', title: "序号", fixed: 'left'},
                {field: 'name', title: '姓名'},
                {field: 'phone', title: '手机号码'},
                {
                    field: 'editDown', title: '下载权限', templet: function (obj) {
                        if (obj.editDown === 1) {
                            return "有";
                        } else {
                            return "无"
                        }
                    }
                },
                {field: 'enterpriseName', title: '关联企业'},
                {fixed: 'right', title: '操作', toolbar: '#myOperateBtn', width: 230, align: 'center'}

            ],
            tab: true,
            onEvent: function (event, id, obj) {
                if (event === "reset") {
                    layer.confirm('确定要重置密码吗？', {icon: 3, title: '提示'}, function (index) {
                        layer.close(index);
                        post("${request.contextPath}/gen/user/reset", {_id: id})
                    });
                }
            }
        })

    });

</script>
</body>
</html>
